<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var a = prompt("阶乘计算器：输入数字", "3");
      var sum = 1;
      while (a >= 1) {
        sum *= a;
        a--;
      }
      document.write("计算结果为" + sum);
    </script>
  </body>
</html>
